import React, { Component } from "react";
import { Grid } from "antd-mobile";
import style from "./index.module.scss";
import {getMenusApi} from "@/api/other"

export default class index extends Component {
  state = {
    list: [],
  };

  componentDidMount(){
    this.getMenus();
  }

  async getMenus(){
    let res = await getMenusApi();
    if(res.data.code===200){
      this.setState({
        list:res.data.list
      })
    }
  }

  render() {
    return (
      <div>
        <Grid className={style.grid} columns={5} gap={10}>
          {this.state.list.map((item) => (
            <Grid.Item className={style.gridItem} key={item.name}>
              <div >{item.name}</div>
            </Grid.Item>
          ))}
        </Grid>
      </div>
    );
  }
}
